<?php echo $this->element('displayHeader'); ?>
<div class="toolbar"><?php echo $this->element('toolbar', array('buttons' => array('add', 'refresh'))); ?></div>

<?php if (empty($this->data)) : // ถ้าไม่มีข้อมูล ?>
<?php echo $this->element('dataNotFound'); ?>
<? else : // ถ้ามีข้อมูล ?>
    <?php $paginator->options(array('update' => 'content', 'indicator' => 'indicator')); ?>
    <?php echo $this->element('dataCaptionLimit'); ?>
    <?php $cur = $paginator->counter(array('format' => '%start%')); ?>

<table class="data">
    <thead>
        <tr>
            <th class="no"><?php echo $paginator->sort('No', 'CRtSH.id'); ?></th>
            <th width="200px"><?php echo $paginator->sort('Return no.', 'CRtSH.return_no'); ?></th>
            <th><?php echo $paginator->sort('Return date', 'CRtSH.return_date'); ?></th>
            <th>Vendor</th>
            <th>Vendor Document no.</th>
            <th><?php echo $paginator->sort('Return by', 'CRtSH.return_by'); ?></th>
            <th>Status</th>
            <th class="action">&nbsp;</th>
        </tr>
    </thead>
    <tbody>
            <?php foreach($this->data as $i => $data): ?>
        <tr class="<?php echo (($i + 1) % 2 == 0)? 'even-cell' : 'odd-cell'; ?>">
            <td><?php echo $i + 1; ?></td>
            <td><?php echo $data['CRtSH']['return_no']; ?></td>
            <td><?php echo $data['CRtSH']['return_date']; ?></td>
            <td><?php echo $data['Supplier']['name']; ?></td>
            <td><?php echo (!empty($data['CRtSH']['vendor_document_no'])? $data['CRtSH']['vendor_document_no']: '') ?></td>
            <td class="center"><?php echo $data['CRtSH']['return_by']; ?></td>
            <td class="center"><?php echo $data['CRS']['title']; ?></td>
            <td>
                <?php echo $ajax->link($html->image('icon/edit.png', array('title' => 'edit', 'alt' => 'edit')), 'view/' . $data['CRtSH']['id'], array('indicator' => 'indicator', 'update' => 'content'), null, false); ?>
            </td>
        </tr>
            <?php endforeach; ?>
    </tbody>
</table>

    <?php echo $this->element('paging'); ?>
<? endif; ?>
<?php //debug($this->data); ?>